﻿#include "URingGraphListUMG.h"

#include "Blueprint/WidgetLayoutLibrary.h"
#include "ListLibrary/ListUIStyle.h"

URingGraphListUMG::URingGraphListUMG()
{

	CenterX = 81;
	CenterY = 81;
	LoopWidth = 21;
	InsideDiameter = 52;
	UseOtherLoop = true;
	UseText = true;
	ShowTextInfo = true;
	Definition = 50;
}

TSharedRef<SWidget> URingGraphListUMG::RebuildWidget()
{
	RingGraphList = SNew(SRingGraphList);
	return RingGraphList.ToSharedRef();
}

const FText URingGraphListUMG::GetPaletteCategory()
{
	return FText::FromString(TEXT("小辉辉"));
}

//资源释放
void URingGraphListUMG::ReleaseSlateResources(bool bReleaseChildren)
{
	Super::ReleaseSlateResources(bReleaseChildren);
	RingGraphList.Reset();
}

//更新数据
void URingGraphListUMG::UpDataList(TMap<FString,int> ListData)
{
	RingGraphList->UpdataListData(ListData);


}
void URingGraphListUMG::MySynchronizeProperties()
{
	SynchronizeProperties();
}
//更新UI
void URingGraphListUMG::SynchronizeProperties()
{
	Super::SynchronizeProperties();
	RingGraphList->CenterX = CenterX;
	RingGraphList->CenterY = CenterY;
	RingGraphList->LoopWidth = LoopWidth;
	RingGraphList->InsideDiameter = InsideDiameter;
	RingGraphList->ShowTextInfo = ShowTextInfo;
	RingGraphList->Definition = (100.0 - Definition) / 100.0;
	if(RingGraphList->Definition < 0.1)
		RingGraphList->Definition = 0.1;
	if(UseOtherLoop)
	{
		RingGraphList->ShowOtherCircle(true);
	}
	else
	{
		RingGraphList->ShowOtherCircle(false);
	}
	if(UseText)
	{
		RingGraphList->ShowText(true);
	}
	else
	{
		RingGraphList->ShowText(false);
	}
}